A log entry should contain all the relevant information about the current execution context. The Exception raised in a catch block not only provides the message but also:
Logging methods provide overloads that
accept an Exception
as a parameter and logging
providers persist the Exception
in a structured way to facilitate the tracking of system failures. Therefore Exceptions
should be passed to the logger.
The rule covers the following logging frameworks: